<template>
  <div id="OrdersTitle">
    <v-details :inputConfig="inputConfig"
               :detailData="inputData"
               :rules="rules"
               ref="input"
               @changeData="changeData"></v-details>
  </div>
</template>

<script>
import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
  props: {
    inputData: {
      type: Object,
    }
  },
  mixins: [baseMixin],
  name: "OrdersTitle",
  data () {
    return {
      addflag: false,
    }
  },
  computed: {
    inputConfig () {
      return [
        [
          {
            type: "select",
            label: this.$t('security.menuLevel'),
            props: "wmwhse",
            disabled: this.addflag,
            options: [
              { code: 'enterprise', description: 'enterprise' },
              { code: 'wmwhse', description: 'wmwhse' },
            ]
          },
          {
            type: "input",
            label: this.$t('security.menuEnName'),
            props: "name",
          },
          {
            type: "input",
            label: this.$t('security.menuName'),
            props: "description",
          },
         {
            type: "input",
            label: this.$t('security.icon'),
            props: "icon",
        },
          {
            type: "input",
            label: this.$t('security.menuId'),
            props: "selfid",
            disabled: true
          },
        ],
        [
          {
            type: "select",
            label: this.$t('security.isRfMenu'),
            props: "isrf",
            options: this.getOptions("codelkup/INTLEAVTSK"),
            disabled: this.addflag,
          }
        ],
      ]
    },
    rules () {
      return {

      }
    }
  }
  ,
  methods: {
    changeData (data) {
      this.$parent.$parent.saveStatus = false;
    }
  },
  mounted () {
    if (Object.keys(this.$store.state.skip).length !== 0) {
      let data = this.$store.state.skip;
      if (data.newFlag) {
        this.addflag = false;
      } else {
        this.addflag = true;
      }
    } else if (this.$store.state.newFlag) {
      this.addflag = false;
    } else {
      this.addflag = true;
    }
  },
  watch: {},
  components: {
    'v-details': details
  }
}
</script>

<style scoped>
</style>
